Page({
  data: {
    scrollTop: 0,
    isIndex: false,
    isShare: false,
    hideTop: false
  },
  setParams(e) {
    let type = Number(e.currentTarget.dataset.type)
    this.setData({
      hideTop: false,
      isIndex: false,
      isShare: false
    })
    switch (type) {
      case 1:
        this.setData({
          isIndex: true
        })
        break;
      case 2:
        this.setData({
          isShare: true
        })
        break;
      case 3:
        this.setData({
          isIndex: true,
          isShare: true
        })
        break;
      case 4:
        this.setData({
          hideTop: true,
          isIndex: true,
          isShare: true
        })
        break;
      case 5:
        this.setData({
          hideTop: true,
          isIndex: true
        })
        break;
      case 6:
        this.setData({
          isShare: true,
          hideTop: true
        })
        break;
      default:
        break;
    }
  },
  goIndex() {
    wx.switchTab({
      url: '/pages/tabbar/index/index'
    });
  },
  onPageScroll(e) {
    if (!this.data.hideTop) {
      this.setData({
        scrollTop: e.scrollTop
      })
    }
  }
})